package com.mdxl.controller;

import com.mdxl.importMdxlBean.ConfigBean;
import com.mdxl.importMdxlBean.ProBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.Collections;
import java.util.Map;

/**
 * Created by chengjian on 2017/9/11.
 */
@RestController
@EnableConfigurationProperties({ConfigBean.class,ProBean.class})
public class HekkoController {
    @Autowired
    private ConfigBean configBean;
    @Autowired
    private ProBean proBean;
    @Value("${logging.config}")
    private String a;
    @Value("${logging.value}")
    private String v;

    @GetMapping("/")
    public Map<String, Object> greeting() {
        return Collections.singletonMap("message", "Hello World");
    }
    @RequestMapping("/first")
    public String mdxlHello(){
        return "hello world";
    }
    @RequestMapping(value = "/mdxl/index",method = RequestMethod.GET,produces = "application/json")
    public String mdxlIndex(){
        String value1= a+configBean.getDataUrl()+"    "+configBean.getNumber()+ configBean.getValue()+v;
        String value2 =proBean.getCity();
        System.out.println("------------------------------------------------------");
        System.out.println(value2);
        return value2;
    }
}
